package com.zl.service;

import com.zl.dao.EmployeeDao;
import com.zl.entity.Employee;
import flexjson.JSONSerializer;

import java.util.List;

/**
 * Employee 业务
 */
public class EmployeeService {
     private EmployeeDao employeeDao=new EmployeeDao();


     /**
     *   查询所有员工对象
     */
     public List<Employee> getAll(){
         return employeeDao.getAll();
     }


    /**
     * 转换成json对象
     */
    public String toJson(List<Employee> employees){
       //创建json转换器对象
        JSONSerializer serializer=new JSONSerializer();
        //排除Class属性
        serializer.exclude("class");
        return serializer.serialize(employees);

    }


}
